﻿using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MonopolyRandy;

namespace MonopolyRandyTests
{
    [TestClass]
    public class PionTests
    {
        private List<Veld> _velden;
        private Pion _hermanPion;
        private Pion _randyPion;

        [TestInitialize]
        public void Setup()
        {
            _velden = new List<Veld>
            {
                new Veld(0, "Start"),
                new StraatVeld(1, "Dorpsstraat", "Ons Dorp",0,0),
                new Veld(2, "Algemeen fonds"),
                new StraatVeld(3, "Brink", "Ons Dorp",0,0),
                new BelastingVeld(4, "Inkomstenbelasting", 200),
                new StationVeld(5, "Station Zuid"),
                new StraatVeld(6, "Steenstraat", "Arnhem",0,0),
                new Veld(7, "Kans"),
                new StraatVeld(8, "Ketelstraat", "Arnhem",0,0),
                new StraatVeld(9, "Velperplein", "Arnhem",0,0),
                new Veld(10, "Gevangenis"),
                new StraatVeld(11, "Barteljorisstraat", "Haarlem",0,0),
                new NutsVeld(12, "Elektriciteitsbedrijf"),
                new StraatVeld(13, "Zijlweg", "Haarlem",0,0),
                new StraatVeld(14, "Houtstraat", "Haarlem",0,0),
                new StationVeld(15, "Station West"),
                new StraatVeld(16, "Neude", "Utrecht",0,0),
                new Veld(17, "Algemeen fonds"),
                new StraatVeld(18, "Biltstraat", "Utrecht",0,0),
                new StraatVeld(19, "Vreeburg", "Utrecht",0,0),
                new Veld(20, "Vrij parkeren"),
                new StraatVeld(21, "A-Kerkhof", "Groningen",0,0),
                new Veld(22, "Kans"),
                new StraatVeld(23, "Grote Markt", "Groningen",0,0),
                new StraatVeld(24, "Heerestraat", "Groningen",0,0),
                new StationVeld(25, "Station Noord"),
                new StraatVeld(26, "Spui", "'s-Gravenhage",0,0),
                new StraatVeld(27, "Plein", "'s-Gravenhage",0,0),
                new NutsVeld(28, "Waterleiding"),
                new StraatVeld(29, "Lange Poten", "'s-Gravenhage",0,0),
                new VerwijsVeld(30, "Naar de gevangenis"),
                new StraatVeld(31, "Hofplein", "Rotterdam",0,0),
                new StraatVeld(32, "Blaak", "Rotterdam",0,0),
                new Veld(33, "Algemeen fonds"),
                new StraatVeld(34, "Coolsingel", "Rotterdam",0,0),
                new StationVeld(35, "Station Oost"),
                new Veld(36, "Kans"),
                new StraatVeld(37, "Leidsestraat", "Amsterdam",0,0), 
                new BelastingVeld(38, "Extra belasting", 100),
                new StraatVeld(39, "Kalverstraat", "Amsterdam",0,0)
            };

            _hermanPion = new Pion(_velden[0], false);
            _randyPion = new Pion(_velden[0], true);
        }

        [TestMethod]
        public void TestOfPionBeginPositieKlopt()
        {
            Assert.AreEqual(expected: _velden[0].GetVeldPositie(), actual: _hermanPion.GetVeldPositie());
            Assert.AreEqual(expected: _velden[0].GetVeldPositie(), actual: _randyPion.GetVeldPositie());
        }

        [TestMethod]
        public void TestOfPionOpEenVeldGezetKanWorden()
        {
            var monopolySpel = new Spel();
            _hermanPion.SetVeld(_velden[0]);
            _randyPion.SetVeld(_velden[39]);

            Assert.AreEqual(expected: _velden[0], actual: _hermanPion.GetVeld());
            Assert.AreEqual(expected: _velden[39], actual: _randyPion.GetVeld());
        }

        [TestMethod]
        public void TestOfPionOpJuisteVeldKomtNaWorp()
        {
            var monopolySpel = new Spel();
            const int aantalGegooideOgen = 7;

            var monopolyBord = new Bord();
            var oudePositiePion = _hermanPion.GetVeldPositie();
            var nieuwePositiePion = monopolyBord.Velden[aantalGegooideOgen + oudePositiePion];
            _hermanPion.SetVeld(veld: nieuwePositiePion);

            Assert.AreEqual(expected: monopolyBord.Velden[7], actual: _hermanPion.GetVeld());
        }
    }
}
